// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.

using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;

namespace GridControl
{
    /// <summary>
    /// Simple read-only designer for the yui control
    /// </summary>
    [SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Justification = "Security handled by base class")]
    public class YuiGridDesigner : ControlDesigner
    {
        /// <summary>
        /// Reference to the YuiGrid control we're designing
        /// </summary>
        private YuiGrid _TabControl;

        /// <summary>
        /// Initialize to make sure we're attached to an YuiGrid control
        /// </summary>
        /// <param name="component">Component</param>
        [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", Justification = "Assembly is not localized")]
        [SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Justification = "Security handled by base class")]
        public override void Initialize(IComponent component)
        {
            _TabControl = component as YuiGrid;
            if (_TabControl == null)
                throw new ArgumentException("Component must be an YuiGrid control", "component");
            base.Initialize(component);
        }

        /// <summary>
        /// Get the HTML for the YuiGrid
        /// </summary>
        /// <returns>HTML design time representation</returns>
        [SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "controls", Justification = "See code comment below")]
        [SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Justification = "Security handled by base class")]
        public override string GetDesignTimeHtml()
        {
            
            
            StringBuilder html = new StringBuilder();
            html.Append(base.GetDesignTimeHtml());
            return html.ToString();
        }
    }
}